package com.lry.basic.algorithm.simple;

/**
 * @author:刘仁有
 * @desc: 判断一个数是否回文数
 * @email:953506233@qq.com
 * @data:2020/1/3
 */
public class IsPalindrome {
    public static void main(String[] args) {
        System.out.println(isPalindrome(-1));
    }
    private static boolean isPalindrome(int x){
        int palindrome = 0;
        int tempX = x;
        while(x>0){
            palindrome = 10*palindrome+x%10;
            x/=10;
        }
        return tempX==palindrome;
    }

    public String toLowerCase(String str) {
        if(null==str||"".equals(str)){
            return str;
        }

        char[] cs = str.toCharArray();
        for(int i=0;i<cs.length;i++){
            if(cs[i]>=65&&cs[i]<=90){
                cs[i] = (char) (cs[i]+32);
            }
        }
        return new String(cs);
    }
}
